package cn.hdu.liang.ch4;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class IterOnce {
    public static void main(String[] args) {
        List<String> names = Arrays.asList("Java8", "Lambdas", "In", "Action");
        Stream<String> s = names.stream();
        s.forEach(System.out::println);

        //会报错，因为流只可以迭代一次,除非再次获得流
        //s = names.stream();
        s.forEach(System.out::println);
    }
}
